﻿@{Layout = null; var table = Model as Loogn.DataMeta.TableInfo;
    Func<string,string> handColumnName=(columnName)=>
    {
        //name_aab
        if (columnName.Length == 1)
        {
            return columnName.ToUpper();
        }
        else
        {
            return columnName.Substring(0, 1).ToUpper() + columnName.Substring(1);
        }
    };

    Func<string, string> getTableName = (tableName) =>
    {
        if (tableName.Length == 1)
        {
            return tableName.ToUpper();
        }
        var parts = tableName.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < parts.Length; i++)
        {
            var item = parts[i];
            if (item.Length == 1)
            {
                parts[i] = item.ToUpper();
            }
            else
            {
                parts[i] = item.Substring(0, 1).ToUpper() + item.Substring(1);
            }
        }
        return string.Join("_", parts);
    };
}
//-----------------------------------------------------------------------
// * Copyright (C) 2018 UU898 Enterprises All Rights Reserved
// * author  : auto generated by ModelGenerator
//-----------------------------------------------------------------------
using System;
using Loogn.OrmLite;

namespace project.model.entity
{
    /// <summary>
    /// @table.Description
    /// </summary>
    public class @(getTableName(table.Name))
    {
    @foreach (var col in table.Columns)
    {
        @:/// <summary>
        @:/// @col.Description
        @:/// </summary>
        if (col.IsPrimaryKey && col.IsIdentity)
        {
        @:[OrmLiteField(IsPrimaryKey = true, InsertIgnore = true)]
        }
        else if (col.IsPrimaryKey)
        {
        @:[OrmLiteField(IsPrimaryKey = true)]
        }
        else if (col.IsIdentity)
        {
        @:[OrmLiteField(InsertIgnore = true)]
        }
        @:public @col.DataType @handColumnName(col.Name) { get; set; }
    }
    }
}